<template>
  <!-- class="app-container" -->
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="" prop="platform">
        <el-select v-model="queryParams.platform" placeholder="平台名称" clearable>
          <el-option v-for="dict in dict.type.sys_sample_name" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item>
      <!--  <el-form-item label="" prop="talentLevel">
        <el-select
          v-model="queryParams.talentLevel"
          placeholder="达人层级"
          clearable
        >
          <el-option
            v-for="dict in dict.type.sys_sample_cj"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item> -->
      <el-form-item label="" prop="platformId">
        <el-input v-model="queryParams.platformId" placeholder="请输入平台ID" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="" prop="xhsNickname" label-width="100px">
        <el-input v-model="queryParams.xhsNickname" placeholder="请输入昵称" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>

      <el-form-item label="" prop="talentStatus">
        <!-- <el-input v-model="queryParams.platform" placeholder="请输入平台名称" clearable @keyup.enter.native="handleQuery" /> -->
        <el-select v-model="queryParams.talentStatus" placeholder="状态" clearable>
          <el-option v-for="dict in dict.type.sys_sample_status" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="逻辑删除;0=未删除；1=已删除" prop="isDelete">
        <el-input v-model="queryParams.isDelete" placeholder="请输入逻辑删除;0=未删除；1=已删除" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain size="mini" @click="handletalentBlockRelease">释放</el-button>
      </el-col>
    </el-row>
    <!-- <div ref="tableDom"> -->
    <el-table v-loading="loading" :maxHeight="sampleList.length ? tableHeight : 'auto'" :data="sampleList"
      @selection-change="handleSelectionChange" :height="620">
      <el-table-column type="selection" width="50" align="center" />
      <el-table-column prop="id" label="ID"></el-table-column>
      <el-table-column prop="platform" label="平台名称"></el-table-column>

      <el-table-column prop="xhsNickname" label="达人昵称"> </el-table-column>
      <el-table-column prop="platformId" label="达人ID" :show-overflow-tooltip="true"></el-table-column>

      <el-table-column label="粉丝量(W)" align="center" prop="fansNum" />
      <el-table-column prop="talentLevel" label="达人层级"></el-table-column>
      <el-table-column prop="talentIntro" label="达人简介"></el-table-column>
      <el-table-column prop="personnelType" label="达人标签"></el-table-column>
      <el-table-column prop="contactPerson" label="跟进媒介（BD）"></el-table-column>
      <el-table-column prop="talentStatus" label="状态"></el-table-column>
      <el-table-column prop="blacklistReason" label="拉黑原因"></el-table-column>
      <el-table-column prop="updateTime" label="操作时间"></el-table-column>
      <el-table-column prop="blacklistBy" label="操作人"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import {
  selectTalentInfoList,
  talentBlockRelease,
  listSample,
  getSample,
  delSample,
  addSample,
  updateSample,
  SampleTalentFirstAdd,
} from "@/api/sample/sample";
export default {
  name: "talentBlock",
  dicts: [
    "sys_product_qudao",
    "sys_sample_status",
    "sys_sample_sf",
    "sys_one_zero",
    "sys_sample_day",
    "sys_sample_time",
    "sys_sample_name",
    "sys_sample_cj",
    "sys_jst_sample_sf",
  ],
  data() {
    return {
      sampleList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        isBlock: "0",
        platform: null,
        talentLevel: null,
        platformId: null,
        xhsNickname: null,
        contactPerson: null,
        recommendSituation: null,
        reason: null,
        personnelType: null,
        homeLink: null,
        fansNum: null,
        likeNum: null,
        cooperatePrice: null,
        contactWechat: null,
        talentStatus: null,
        isDelete: null,
        fansNumStart: null,
        fansNumEnd: null,
        likeNumStart: null,
        likeNumEnd: null,
      },
      loading: true,
      showSearch: true,
    };
  },
  created() {
    this.getList();
  },
  methods: {
    handletalentBlockRelease() {
      if (this.ids.length != 1) {
        this.$modal.msgError("请选择一条数据");
        return;
      }
      talentBlockRelease({ id: this.ids[0] }).then((response) => {
        if (response.code == 200) {
          this.$modal.msgSuccess("已释放达人");
          this.getList();
        }
      });
    },
    /** 查询达人信息列表 */
    getList() {
      this.loading = true;
      selectTalentInfoList(this.queryParams).then((response) => {
        this.sampleList = response.rows;
        console.log(JSON.stringify(this.sampleList));
        this.total = response.total;
        this.loading = false;
      });
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        platform: null,
        talentLevel: null,
        platformId: null,
        xhsNickname: null,
        contactPerson: null,
        recommendSituation: null,
        reason: null,
        personnelType: null,
        homeLink: null,
        fansNum: null,
        likeNum: null,
        cooperatePrice: null,
        contactWechat: null,
        talentStatus: null,
        isDelete: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
  },
};
</script>